const BASE_URL = "https://wyym.sixmillions.cn"
/**
 * api请求基础封装
 */
class ApiRequest {

    request(url, method, params) {
        return new Promise((resolve, reject) => {
            wx.request({
                url: BASE_URL + url,
                method: method,
                data: params,
                success: function (res) {
                    resolve(res.data)
                },
                fail: reject
            })
        })
    }

    get(url, params) {
        return this.request(url, "GET", params)
    }

    post(url, data) {
        return this.request(url, "POST", data)
    }

}

const apiRequest = new ApiRequest()

export default apiRequest